package edu.sctu.practice.class02.yangshengyu.text01.test02;

import java.util.Scanner;

/**
 * Created by Cullen on 2015/10/10.
 */
public class Vehicle {
    int speed;
    double size;
    public void move() {
        System.out.println("It can move!");
    }

    public int setSpeed(int speed) {
        this.speed = speed;
        return this.speed;
    }

    public double setSize(double sizeValue) {
        this.size = sizeValue;
        return this.size;
    }

    public void upSpeed() {                      //加速方法
        System.out.println("请设置加速后的速度：");
        Scanner va = new Scanner(System.in);
        int val = va.nextInt();
        speed = val;
        System.out.println("加速后的速度为：" + speed);
    }

    public void downSpeed() {                          //减速方法
        System.out.println("请设置减速后的速度：");
        Scanner va = new Scanner(System.in);
        int val = va.nextInt();
        speed = val;
        System.out.println("减速后的速度为：" + speed);

    }

    public static void main(String[] args) {
        Vehicle vehicle = new Vehicle();

        System.out.println("请输入初始速度：");          //获取初始速度
        Scanner val = new Scanner(System.in);
        int va = val.nextInt();

        System.out.println("请输入初始大小：");
        Scanner vall = new Scanner(System.in);
        double vaa = vall.nextDouble();               //获取初始大小

        System.out.println("初始速度为：" + vehicle.setSpeed(va));

        System.out.println("初始大小为：" + vehicle.setSize(vaa));

        vehicle.move();

        vehicle.upSpeed();

        vehicle.downSpeed();
    }
}
